package com.dliu.javadesign.behaviour.chain;

import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

/**
 * @author yanglei
 * date 2021/4/23 10:32
 */
public interface Handle {
    Boolean process(Sport sport);
}

@Accessors(chain = true)
@Data
class Sport{
    private String name;
}

@Slf4j
class Liu implements Handle {
    @Override
    public Boolean process(Sport sport) {
        if ("running".equals(sport.getName())){
            log.info("liu running");
            return true;
        }
        return false;
    }
}

@Slf4j
class Yang implements Handle {
    @Override
    public Boolean process(Sport sport) {
        if ("jump".equals(sport.getName())){
            log.info("yang jump");
            return true;
        }
        return false;
    }
}

@Slf4j
class Yu implements Handle {
    @Override
    public Boolean process(Sport sport) {
        if ("swim".equals(sport.getName())){
            log.info("yu swim");
            return true;
        }
        return false;
    }
}

